import Vue from 'vue'
import App from './App.vue'
import VueLazyload from 'vue-lazyload'
import router from "@/router/index"//接收路由
import Typenav from "@/components/TypeNav/Typenav"
import Slideshow from "@/components/Slideshow/Slideshow"
import Page from "@/components/Page/Page"
import 'swiper/css/swiper.css'
import { Message } from 'element-ui';
import {MessageBox} from 'element-ui'
import {reqPayState,reqMyList} from '@/api/index'
import loading from '../public/images/loading.gif'
import store from './store/index'
import '@/plugin/validate'
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$message = Message;
Vue.use(VueLazyload,{  
  loading        //加载的默认图片
})
Vue.config.productionTip = false
Vue.component("Typenav",Typenav)
Vue.component('Slideshow',Slideshow)
Vue.component('Page',Page)
const $api = {  
  async getPayState(value){
    return await reqPayState(value)
  },
  async getMyGoodList(page,limit){
  const result = await reqMyList(page,limit)
  if(result.code == 200){
    return [result.data,result]
  }else{
    return Promise.reject('出错啦',result)
  }
  }
}
import '@/mock/mockSever'//让mock文件至少执行一次
new Vue({
  render: h => h(App),
  store,
  router,//导入路由
  beforeCreate(){
    Vue.prototype.$bus = this,
    Vue.prototype.$api = $api
  }
}).$mount('#app')
